<?php
namespace app\index\controller;

use app\index\model\JwSchool as JwSchoolModel;

class Jwschool extends Base{

    public function search(){
        $res = new JwSchoolModel();
        $data=$this->request->param();
        $a = $data['name'];
        $d =$res->where('teacher', 'like', '%'.$a.'%')
            ->where($data['field'],$data['op'],$data['value'])
            ->order('id desc')
            ->select();
        return $d;
    }
    public function getList(){
        $user = new JwSchoolModel();
        $data=$this->request->param();
        $res1=$user->where($data['field'],$data['op'],$data['value'])
        ->order('id asc')
        ->limit(10)
        ->page($data['page'])
        ->select();
        return $res1;
    }
    public function update()
    {
        $data = $this->request->param();
        $res = new JwSchoolModel();
        return $res->updateModel($data);
    }
    public function delete(){
        $data = $this->request->param();
        $res = new JwSchoolModel();
        return $res->deleteModel($data);
    }
    public function save(){
        $res = new JwSchoolModel();
        $data = $this->request->param();
        $res->saveModel($data);
    }
    public function num(){
        $data = $this->request->param();
        $res =new JwSchoolModel();
        return $res->where($data['field'],$data['op'],$data['value'])->count();
    }

}